package ym.ecrm.core.domain.financeManagement;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import ym.ecrm.core.domain.base.BaseEntity;
import ym.ecrm.core.domain.systemManagement.User;

/**
 * 收款类
 * @author fage
 *@version 1.0
 */

@Entity
@Table(name = "t_collection")
public class Collection extends BaseEntity {
	/**
	 * CollectionCode 管理收款编号
	 */
	private String CollectionCode;
	/**
	 * accountsReceivable 对应应收账款
	 */
	@OneToMany(targetEntity=AccountsReceivable.class
			,cascade = {CascadeType.PERSIST,CascadeType.MERGE}
			,fetch =FetchType.EAGER )
	@JoinColumn(name ="collectionId")
	private Set<AccountsReceivable> accountsReceivables = new HashSet<AccountsReceivable>();
	
	/**
	 * customerName 客户名称
	 */
	private String customerName;
	/**
	 * sum 金额
	 */
	private String sum;
	/**
	 * balanceTime 结算时间
	 */
	private String balanceTime;
	/**
	 * user 经手人
	 */
	@ManyToOne(targetEntity = User.class
			, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "userId")
	private User user;
	
	
	
	
	public String getCollectionCode() {
		return CollectionCode;
	}
	public void setCollectionCode(String collectionCode) {
		CollectionCode = collectionCode;
	}
	public Set<AccountsReceivable> getAccountsReceivables() {
		return accountsReceivables;
	}
	public void setAccountsReceivables(Set<AccountsReceivable> accountsReceivables) {
		this.accountsReceivables = accountsReceivables;
	}
	public String getCustomerName() {
		return customerName;
	}
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
	public String getSum() {
		return sum;
	}
	public void setSum(String sum) {
		this.sum = sum;
	}
	public String getBalanceTime() {
		return balanceTime;
	}
	public void setBalanceTime(String balanceTime) {
		this.balanceTime = balanceTime;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
}
